/**
 * 计数器，用于判断多个并发请求是否全部完成
 */
window.Counter = {
    build(size) {
        var counter = {
            size: size,
            executeSize: 0,
            call: function () {
                counter.executeSize ++;
                if(counter.executeSize == counter.size) {
                    if(counter.finishCall != null) {
                        counter.finishCall();
                    }
                }
            },
            finishCall: null,
            finish(finishCall) {
                counter.finishCall = finishCall;
            }
        };
        return counter;
    }
};